Accounting = Ember.Application.create();
//JQuery extension for objects
$.extend({
	createObjectClasses: function() { //Initializes classes
		Accounting.Account = Ember.Object.extend({
			accountId: null,
			accountName: null,
			accountTypeId: null,
			color: null,
			jsonString: function() {
				var jsonStr = "{";
				jsonStr+="\"accountId\":" + ((this.accountId==null) ? "null," : "\"" + this.accountId + "\",");
				jsonStr+="\"accountName\":" + ((this.accountName==null) ? "null," : "\"" + this.accountName + "\",");
				jsonStr+="\"accountTypeId\":" + ((this.accountTypeId==null) ? "null," : "\"" + this.accountTypeId + "\",");
				jsonStr+="\"color\":" + ((this.color==null) ? "null" : "\"" + this.color + "\"");
				jsonStr+="}";
				return jsonStr;
			}
		});
		Accounting.AccountType = Ember.Object.extend({
			accountTypeId: null,
			accountTypeName: null,
			jsonString: function() {
				var jsonStr = "{";
				jsonStr+="\"accountTypeId\":" + ((this.accountTypeId==null) ? "null," : "\"" + this.accountTypeId + "\",");
				jsonStr+="\"accountTypeName\":" + ((this.accountTypeName==null) ? "null" : "\"" + this.accountTypeName + "\"");
				jsonStr+="}";
				return jsonStr;
			}
		});
		Accounting.ExpenseTransaction = Ember.Object.extend({
			accountId: null,
			amount: null,
			entity: null,
			entityId: null,
			txnDay: null,
			txnMonth: null,
			txnYear: null,
			txnId: null,
			jsonString: function() {
				var jsonStr = "{";
				jsonStr+="\"accountId\":" + ((this.accountId==null) ? "null," : "\"" + this.accountId + "\",");
				jsonStr+="\"amount\":" + ((this.amount==null) ? "null," : "\"" + this.amount + "\",");
				jsonStr+="\"entity\":" + ((this.entity==null) ? "null," : this.entity.jsonString() + ",");
				jsonStr+="\"entityId\":" + ((this.entityId==null) ? "null," : "\"" + this.entityId + "\",");
				jsonStr+="\"txnDay\":" + ((this.txnDay==null) ? "null," : "\"" + this.txnDay + "\",");
				jsonStr+="\"txnMonth\":" + ((this.txnMonth==null) ? "null," : "\"" + this.txnMonth + "\",");
				jsonStr+="\"txnYear\":" + ((this.txnYear==null) ? "null," : "\"" + this.txnYear + "\",");
				jsonStr+="\"txnId\":" + ((this.txnId==null) ? "null" : "\"" + this.txnId + "\"");
				jsonStr+="}";
				return jsonStr;
			}
		});
		Accounting.ExternalEntity = Ember.Object.extend({
			entityId: null,
			entityName: null,
			ieCategory: null,
			ieCategoryId: null,
			jsonString: function() {
				var jsonStr = "{";
				jsonStr+="\"entityId\":" + ((this.entityId==null) ? "null," : "\"" + this.entityId + "\",");
				jsonStr+="\"entityName\":" + ((this.entityName==null) ? "null," : "\"" + this.entityName + "\",");
				jsonStr+="\"ieCategory\":" + ((this.ieCategory==null) ? "null," : this.ieCategory.jsonString() + ",");
				jsonStr+="\"ieCategoryId\":" + ((this.ieCategoryId==null) ? "null" : "\"" + this.ieCategoryId + "\"");
				jsonStr+="}";
				return jsonStr;
			}
		});
		Accounting.IncomeExpenseCategory = Ember.Object.extend({
			categoryId: null,
			categoryName: null,
			categoryType: null,
			parentCategoryId: null,
			jsonString: function() {
				var jsonStr = "{";
				jsonStr+="\"categoryId\":" + ((this.categoryId==null) ? "null," : "\"" + this.categoryId + "\",");
				jsonStr+="\"categoryName\":" + ((this.categoryName==null) ? "null," : "\"" + this.categoryName + "\",");
				jsonStr+="\"categoryType\":" + ((this.categoryType==null) ? "null," : "\"" + this.categoryType + "\",");
				jsonStr+="\"parentCategoryId\":" + ((this.parentCategoryId==null) ? "null" : "\"" + this.parentCategoryId + "\"");
				jsonStr+="}";
				return jsonStr;
			}
		});
		Accounting.IncomeTransaction = Ember.Object.extend({
			accountId: null,
			amount: null,
			entity: null,
			entityId: null,
			txnDay: null,
			txnMonth: null,
			txnYear: null,
			txnId: null,
			jsonString: function() {
				var jsonStr = "{";
				jsonStr+="\"accountId\":" + ((this.accountId==null) ? "null," : "\"" + this.accountId + "\",");
				jsonStr+="\"amount\":" + ((this.amount==null) ? "null," : "\"" + this.amount + "\",");
				jsonStr+="\"entity\":" + ((this.entity==null) ? "null," : this.entity.jsonString() + ",");
				jsonStr+="\"entityId\":" + ((this.entityId==null) ? "null," : "\"" + this.entityId + "\",");
				jsonStr+="\"txnDay\":" + ((this.txnDay==null) ? "null," : "\"" + this.txnDay + "\",");
				jsonStr+="\"txnMonth\":" + ((this.txnMonth==null) ? "null," : "\"" + this.txnMonth + "\",");
				jsonStr+="\"txnYear\":" + ((this.txnYear==null) ? "null," : "\"" + this.txnYear + "\",");
				jsonStr+="\"txnId\":" + ((this.txnId==null) ? "null" : "\"" + this.txnId + "\"");
				jsonStr+="}";
				return jsonStr;
			}
		});
		Accounting.MonthendAccountBalance = Ember.Object.extend({
			accountId: null,
			calendarId: null,
			balance: null,
			jsonString: function() {
				var jsonStr = "{";
				jsonStr+="\"accountId\":" + ((this.accountId==null) ? "null," : "\"" + this.accountId + "\",");
				jsonStr+="\"calendarId\":" + ((this.calendarId==null) ? "null," : "\"" + this.calendarId + "\",");
				jsonStr+="\"balance\":" + ((this.balance==null) ? "null" : "\"" + this.balance + "\"");
				jsonStr+="}";
				return jsonStr;
			}
		});
		Accounting.MonthendCategoryTotal = Ember.Object.extend({
			ieCategoryId: null,
			calendarId: null,
			total: null,
			jsonString: function() {
				var jsonStr = "{";
				jsonStr+="\"ieCategoryId\":" + ((this.ieCategoryId==null) ? "null," : "\"" + this.ieCategoryId + "\",");
				jsonStr+="\"calendarId\":" + ((this.calendarId==null) ? "null," : "\"" + this.calendarId + "\",");
				jsonStr+="\"total\":" + ((this.total==null) ? "null" : "\"" + this.total + "\"");
				jsonStr+="}";
				return jsonStr;
			}
		});
		Accounting.MonthwiseCalendar = Ember.Object.extend({
			calendarId: null,
			month: null,
			year: null,
			jsonString: function() {
				var jsonStr = "{";
				jsonStr+="\"calendarId\":" + ((this.calendarId==null) ? "null," : "\"" + this.calendarId + "\",");
				jsonStr+="\"month\":" + ((this.month==null) ? "null," : "\"" + this.month + "\",");
				jsonStr+="\"year\":" + ((this.year==null) ? "null" : "\"" + this.year + "\"");
				jsonStr+="}";
				return jsonStr;
			}
		});
		Accounting.TransferTransaction = Ember.Object.extend({
			amount: null,
			fromAccountId: null,
			toAccountId: null,
			txnDay: null,
			txnMonth: null,
			txnYear: null,
			txnId: null,
			jsonString: function() {
				var jsonStr = "{";
				jsonStr+="\"amount\":" + ((this.amount==null) ? "null," : "\"" + this.amount + "\",");
				jsonStr+="\"fromAccountId\":" + ((this.fromAccountId==null) ? "null," : "\"" + this.fromAccountId + "\",");
				jsonStr+="\"toAccountId\":" + ((this.toAccountId==null) ? "null," : "\"" + this.toAccountId + "\",");
				jsonStr+="\"txnDay\":" + ((this.txnDay==null) ? "null," : "\"" + this.txnDay + "\",");
				jsonStr+="\"txnMonth\":" + ((this.txnMonth==null) ? "null," : "\"" + this.txnMonth + "\",");
				jsonStr+="\"txnYear\":" + ((this.txnYear==null) ? "null," : "\"" + this.txnYear + "\",");
				jsonStr+="\"txnId\":" + ((this.txnId==null) ? "null" : "\"" + this.txnId + "\"");
				jsonStr+="}";
				return jsonStr;
			}
		});
		Accounting.WeeklyBalance = Ember.Object.extend({
			amount: null,
			description: null,
			jsonString: function() {
				var jsonStr = "{";
				jsonStr+="\"amount\":" + ((this.amount==null) ? "null," : "\"" + this.amount + "\",");
				jsonStr+="\"description\":" + ((this.description==null) ? "null" : "\"" + this.description + "\"");
				jsonStr+="}";
				return jsonStr;
			}
		});
		Accounting.SecureRequestParam = Ember.Object.extend({
			criteria: null,
			expenseTransaction: null,
			fbCode: null,
			incomeTransaction: null,
			transferTransaction: null,
			weeklyBalanceUpdates: null,
			year: null,
			jsonString: function() {
				var jsonStr = "{";
				jsonStr+="\"criteria\":" + ((this.criteria==null) ? "null," : this.criteria.jsonString() + ",");
				jsonStr+="\"expenseTransaction\":" + ((this.expenseTransaction==null) ? "null," : this.expenseTransaction.jsonString() + ",");
				jsonStr+="\"fbCode\":" + ((this.fbCode==null) ? "null," : "\"" + this.fbCode + "\",");
				jsonStr+="\"incomeTransaction\":" + ((this.incomeTransaction==null) ? "null," : this.incomeTransaction.jsonString() + ",");
				jsonStr+="\"transferTransaction\":" + ((this.transferTransaction==null) ? "null," : this.transferTransaction.jsonString() + ",");
				jsonStr+="\"weeklyBalanceUpdates\":" + ((this.weeklyBalanceUpdates==null) ? "null," : this.weeklyBalanceUpdates.jsonString() + ",");
				jsonStr+="\"year\":" + ((this.year==null) ? "null" : "\"" + this.year + "\"");
				jsonStr+="}";
				return jsonStr;
			}
		});
	}
});

 